package com.hc.dubboclient.controller;

import com.hc.service.HelloService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    /**
     * stub:本地存根:在消费方做一些参数校验等逻辑处理
     */
    @DubboReference(stub = "com.hc.dubboclient.controller.HelloServiceStub")
    private HelloService helloService;

    @RequestMapping(value = "sayHello",method = RequestMethod.GET)
    public String sayHello(@RequestParam String name){
        return helloService.sayHello(name);
    }
}
